Add Method (TKey, TValue)

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Adds a new key and value to the dictionary. If the dictionary already contains a key equal to the passed key, then an ArgumentException is thrown

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public override sealed void Add(
	TKey key,
	TValue value
)
Visual Basic (Declaration)
Public Overrides NotOverridable Sub Add ( _
	key As TKey, _
	value As TValue _
)
Visual C++
public:
virtual void Add (
	TKey key, 
	TValue value
) override sealed

Parameters

key
TKey
The new key. "null" is a valid key value.
value
TValue
The new value to associated with that key.

Remarks

Equality between keys is determined by the comparison instance or delegate used to create the dictionary.

Adding an key and value takes time O(log N), where N is the number of keys in the dictionary.

Exceptions

ExceptionCondition
System..::ArgumentExceptionkey is already present in the dictionary

See Also